#include<iostream>
#include<unordered_map>
using namespace std;

const int N=1e6+10;
int arr[N];
int sign[N];

int main()
{
	int n, m; cin>>n>>m;
	int a=1, b=n;
	for(int i=1; i<=n; i++) cin>>arr[i];
	
	int l=1, r=1, kind=0;
	while(r<=n)
	{
		if(sign[arr[r]]==0) kind++;
		sign[arr[r]]++;
		while(kind==m)
		{
			if(b-a>r-l || ((b-a==r-l) && l<a))
			{
				a=l;
				b=r;
			}
			sign[arr[l]]--;
			if(sign[arr[l]]==0) kind--;
			l++;
		}
		r++;
	} 
	cout<<a<<" "<<b;
	return 0;
}
